(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const { exec } = require('child_process');
    const fs = require('node:fs');
    async function getDeviceList() {
        const command = 'chcp 65001 && powershell -Command "Get-PnpDevice | ConvertTo-Json -Compress"';
        return new Promise((resolve, reject) => {
            exec(command, (error, stdout, stderr) => {
                if (error) {
                    console.error(`错误: ${error.message}`);
                    return null;
                }
                if (stderr) {
                    console.error(`stderr: ${stderr}`);
                    return null;
                }
                const stringLength = stdout.length;
                const driversStr = stdout.substring(25, stringLength);
                const drivers = JSON.parse(driversStr);
                resolve(drivers);
            });
        });
    }
    exports.default = getDeviceList;
});
